#!/usr/bin/python
# encoding: utf-8
'''
@File    :   code.py
@Time    :   2020/03/11 21:54:19
@Author  :   fangkaijin 
@Version :   1.0
@Contact :   fangkaijin@gmail.com
@License :   杭州移动互联
@Desc    :   None
'''

# 导入库包

import sys, os

def foo(num, total = 10):
    while True:
        if num<total:
            num +=1
            yield num
        else:
            break
for n in foo(5, 16):
    print('循环结果 %d .' % (n))


'''
修饰器
'''
def before(fn):
    def wrapped():
        print('方法执行前处理数据')
        fn()
    return wrapped

def after(fn):
    def wrapped():
        fn()
        print('方法执行后执行')
    return wrapped

@before
@after
def hello():
    print('hello, world')

hello()

